#!/bin/bash

# Test unaligned dog vdi read/write

. ./common

for i in `seq 0 5`; do
    _start_sheep $i
done

_wait_for_sheep 6

_cluster_format -c 6

_vdi_create test 4095
sleep 1
$DOG vdi list -r test | awk '{$7="MASKED";print $0}'

echo hello | $DOG vdi write test 1 6
$DOG vdi read test 1 6
echo world | $DOG vdi write test 1 6
$DOG vdi read test 1 6

echo h*** | $DOG vdi write test 510 512
echo h!!! | $DOG vdi write test 510 512
$DOG vdi read test 510 5
echo ^^ | $DOG vdi write test 511 2
$DOG vdi read test 510 5
echo xxx | $DOG vdi write test 1020 4
$DOG vdi read test 1020 4
$DOG vdi read test 510 5
$DOG vdi read test 1 6

echo erasure code | $DOG vdi write test 1020 13
echo xxxxxx | $DOG vdi write test  1022 6
$DOG vdi read test 1020 13
